import axios from "axios";
import { Toast } from "antd-mobile";

const instance = axios.create({
  baseURL: "https://www.linweiqin.cn/api/public/v1/",
});
//请求的拦截
instance.interceptors.request.use(
  function (config) {
    Toast.loading("正在加载中...", 0, null, true);
    return config;
  },
  function (err) {
    return Promise.reject(err);
  }
);
//响应的拦截
instance.interceptors.response.use(
  (response) => {
    Toast.hide();
    return response.data.message;
  },
  (err) => {
    return Promise.reject(err);
  }
);
export default instance;
